//
//  GQPicturePlayerCell.m
//  TingMusic
//
//  Created by sunny on 16/4/20.
//  Copyright © 2016年 sunny. All rights reserved.
//

#import "GQPicturePlayerCell.h"
#import "GQPicturePlayerItem.h"
#import <WebKit/WebKit.h>

@interface GQPicturePlayerCell ()
@property (nonatomic,weak)UIImageView *imageView;
@end

@implementation GQPicturePlayerCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
//        创建imageView子控件
        UIImageView *imageView = [[UIImageView alloc] init];
        imageView.userInteractionEnabled = YES;
        self.imageView = imageView;
        [self.contentView addSubview:imageView];
        
//        添加手势
        UIGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tap)];
        [imageView addGestureRecognizer:tap];
    }
    return self;
}

- (void)tap
{
//    发送通知
    [[NSNotificationCenter defaultCenter] postNotificationName:@"imageViewDidTapotification" object:nil];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.imageView.frame = self.contentView.bounds;
}

- (void)setItem:(GQPicturePlayerItem *)item
{
    _item = item;
    
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:item.randpic_iphone6]];
}
@end
